1. Field of the Invention
Methods and systems consistent with the present invention relate to managing resources used by applications and threads in the applications, and more particularly, to managing resources used by applications and threads in the applications in a containment framework environment in which an application manager resides, thereby executing/ending several Java applications, wherein the containment framework is within electronic equipment.
2. Description of the Related Art
A Java Virtual Machine (JVM) enables downloading of an application and executing the application in a network environment, so that the JVM is used as a standard application performance environment in various information equipment.
FIG. 1 is a block diagram illustrating a representative configuration of a related art JVM.
A JVM 101 basically includes a class loader 102 which embeds a class (a binary executable file format of Java), a Just-In-Time (JIT) compiler 104 which pre-converts commands of a virtual machine (e.g. JVM) into machine codes of a Central Processing Unit (CPU) while performing a class, thereby improving speed, an interpreter 105 which recognizes commands of a virtual machine as components for executing performance codes of a class and then carrying out the commands, and a Garbage Collector (GC) 106 which manages resources during runtime.
FIG. 2 is a block diagram illustrating an example of a containment framework in which an application manager resides, thereby generating and ending several applications. The containment framework includes an Operation System (OS) 205, a JVM 204, middleware 203, e.g., OpenCable Application Platform (OCAP) or Advanced Common Application Platform (ACAP), which enables an application to be operated, an application manager 202 which manages a lifecycle of an application, Java applications 1 through n 206, and a native application 207.
FIG. 3 is a diagram illustrating an example of electronic equipment including a containment framework 306 illustrated in FIG. 2, wherein the example is digital data broadcasting information equipment. The information equipment includes a CPU 303, a display processor 302, a main memory 305 required so as to execute a program, and additional hardware 304 including an external connection port, such as a Universal Serial Bus (USB) port, a Serial port, an infrared (IR) port or the like, a flash memory, Ethernet, a hard disk, or the like. The containment framework 306 is installed as software in the main memory 305.
Resources used in a JVM vary according to a method of implementing the JVM, Java middleware performed in the JVM, and types of Java applications. In general, when a Java application is performed in a JVM, representative examples of resources used are a file, a socket, a native memory, a heap memory, a CPU occupation rate, a CPU runtime, or the like.
FIG. 4 is a flowchart illustrating operations for generating and ending an application operated by an application manager 202 in a containment framework illustrated in FIG. 2.
First, the application manager 202 receives a request for generating a new application (operation 401), then generates an identifier for identifying an application (operation 402), and stores the identifier (operation 403). Next, the application is started (operation 404), a state is changed according to a lifecycle of the application, and then the application is ended (operation 405). In this related art process of generating and ending an application, it is possible to recognize that an operation for tracking resources used by an application and threads in the application is not considered at all.
FIG. 5 is a flowchart illustrating a process of allocating/releasing resources, wherein the process is performed when a Java application in a containment framework as illustrated in FIG. 2 is performed. Recently, a Multitasking Virtual Machine (MVM) technology ensuring complete independence of respective applications has been implemented. In the MVM, it is general to set a quota of resources related to the respective applications that are performed. A method of setting a quota may vary according to each of MVM solutions. However, in a general performing process, a request for allocating a specific resource is received (operation 501). Then, it is determined whether the sum of a quantity of usage for the resource currently being used by an application and a newly requested resource quantity, exceeds a maximum limit that is allowed for the application to use the resource (operation 502). If it is determined that the sum does not exceed the maximum limit, an update for increasing a quantity of usage for the resource as much as necessary according to the request is performed (operation 504), and thereby allocating the updated resource (operation 505). If it is determined that the sum exceeds the maximum limit that is allowed for the application to use the resource, the request for allocating the resource is rejected, i.e., an exception occurs (operation 503).
In this manner, in a conventional Java platform, a method of perceiving a current usage status of various kinds of resources such as a CPU runtime, a CPU occupation rate, a socket, a file, a native memory or the like used by an application and a thread (that is the smallest execution unit of a program) in the application executed in a JVM, and the method of setting a usage limitation for the resources is not provided. The only information on using resources, wherein the information is provided by a standard Java platform is a current quantity of usage and a maximum limit of a Java heap memory. In a conventional MVM environment, a method of managing resources used by an application is to set a quota related to each of the resources and to consider a current quantity of usage. However, there are limitations to this method since information in consideration of the quota and the quantity of usage for the resources is output in application units, it is impossible to know a quantity of usage consumed by each thread. Also, since there is no notification function for informing about variations in a quantity of resource usage by an application, it is impossible to know the degree of usage unless the quantity of resource usage is periodically checked. Finally, since a standard resource management method ensuring extension is not presented, each system selects a resource management method in an Ad-hoc mode, and is thereby incapable of ensuring compatibility for managing resources.
However, in recently developed electronic equipment e.g., Digital Television (DTV), set-top boxes, mobile phones, and the like, in which several Java applications are simultaneously performed, by using an application manager, managing resources used by each of the applications and threads in the applications is necessary so as to efficiently and fairly use limited resources.